package com.service;

import java.io.IOException;
import java.util.List;

import javax.jws.WebService;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.directwebremoting.WebContext;
import org.directwebremoting.WebContextFactory;

import com.dao.TAdminDAO;
import com.model.TAdmin;
/**
 * Servlet implementation class loginService1
 */
public class loginService1 extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private TAdminDAO adminDAO;
    /**
     * @see HttpServlet#HttpServlet()
     */
    public loginService1() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		response.getWriter().append("Served at: ").append(request.getContextPath());
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String userName=request.getParameter("userName");
		String userPw=request.getParameter("userPw");
	 loginService t=new loginService();
	String g= t.login(userName, userPw, 0);
	if(g=="yes")
		   request.getRequestDispatcher("guanlidefault.jsp").forward(request, response);
	else
		request.getRequestDispatcher("shibai.jsp").forward(request, response);
	}
}
